package edu.gdpu.bytecode;

/**
 * @author mazebin
 * @date 2021年 07月09日 16:47:04
 * 异常处理带有finally
 */
public class ByteCodeTest7 {
    public static void main(String[] args) {
        int i = 0;
        try {
            i = 10;
        } catch ( Exception e ) {
            i = 20;
        } finally {
            i = 30;
        }
    }
    /**
     * 字节码
     *   Code:
     *       stack=1, locals=4, args_size=1
     *          0: iconst_0         --将0压入栈
     *          1: istore_1         --0->i
     *          2: bipush        10 --将10压入栈
     *          4: istore_1         --10->i
     *          5: bipush        30 -->finallty，将30压入栈
     *          7: istore_1
     *          8: goto          27
     *         11: astore_2
     *         12: bipush        20
     *         14: istore_1
     *         15: bipush        30
     *         17: istore_1
     *         18: goto          27   -->无条件跳转
     *         21: astore_3
     *         22: bipush        30
     *         24: istore_1
     *         25: aload_3
     *         26: athrow     -->抛出异常
     *         27: return      --》返回void
     *       Exception table:
     *          from    to  target type
     *              2     5    11   Class java/lang/Exception
     *              2     5    21   any
     *             11    15    21   any
     *
     */
             }
